package com.rdgk.newtech.controller;

import com.alibaba.fastjson.JSONObject;
import com.rdgk.newtech.service.AuthorAnalyseService;
import com.rdgk.newtech.service.ProjectService;
import com.rdgk.newtech.util.CommonUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @author: 高亚杰
 * @description: 专家动态数据接口Controller
 */
@RestController
@RequestMapping("/authoranalyse")
public class AuthorAnalyseController {

	@Autowired
	private AuthorAnalyseService authorAnalyseService;

	/**
	 *重点专家列表
	 */
	@PostMapping("/importantAuthorList")
	public JSONObject importantAuthorList(HttpServletRequest request) {
		String topicId = request.getParameter("topicId");
		return CommonUtil.successJson(authorAnalyseService.importantAuthorList(Integer.parseInt(topicId),null));
	}

	/**
	 *技术动态信息区域分布
	 */
    @PostMapping("/technologyRegionalDistribution")
    public JSONObject technologyRegionalDistribution(HttpServletRequest request) {
		String topicId = request.getParameter("topicId");
        return CommonUtil.successJson(authorAnalyseService.technologyRegionalDistribution(Integer.parseInt(topicId),null));
    }

	/**
	 * 某个专题下面所有专家的合作网络
	 */
	@PostMapping("/allAuthorCooperateNet")
	public JSONObject allAuthorCooperateNet(HttpServletRequest request) {
		String topicId = request.getParameter("topicId");
		String keyword = request.getParameter("keyword");
		return CommonUtil.successJson(authorAnalyseService.allAuthorCooperateNet(Integer.parseInt(topicId),keyword));
	}

	/**
	 * 获取某个专家的详情
	 */
	@PostMapping("/authorDetail")
	public JSONObject authorDetail(HttpServletRequest request) {
		String topicId = request.getParameter("topicId");
		String authorId = request.getParameter("authorId");
		return CommonUtil.successJson(authorAnalyseService.authorDetail(Integer.parseInt(topicId),Integer.parseInt(authorId)));
	}
}
